package sk.tuke.persistance;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@org.hibernate.annotations.Proxy(lazy = false)
@Table(name = "MEDICAL_NOTE")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class MedicalNotePo implements Serializable {

	private static final long serialVersionUID = 1L;

	public MedicalNotePo() {
	}

	public boolean equals(Object aObj) {
		if (aObj == this)
			return true;
		if (!(aObj instanceof MedicalNotePo))
			return false;
		MedicalNotePo medicalnote = (MedicalNotePo) aObj;
		if (getId() != medicalnote.getId())
			return false;
		return true;
	}

	public int hashCode() {
		int hashcode = 0;
		hashcode = hashcode + (int) getId();
		return hashcode;
	}

	@Column(name = "id", nullable = false)
	@Id
	@GeneratedValue(generator = "MEDICAL_NOTE_ID_GENERATOR")
	@org.hibernate.annotations.GenericGenerator(name = "MEDICAL_NOTE_ID_GENERATOR", strategy = "native")
	private int id;

	@ManyToOne(targetEntity = MedicalRecordPo.class, fetch = FetchType.LAZY)
	@org.hibernate.annotations.Cascade({ org.hibernate.annotations.CascadeType.LOCK })
	@JoinColumns({ @JoinColumn(name = "m_record_id", referencedColumnName = "id") })
	@org.hibernate.annotations.LazyToOne(value = org.hibernate.annotations.LazyToOneOption.NO_PROXY)
	private MedicalRecordPo medicalRecord;

	@Column(name = "name", nullable = false, length = 100)
	private String name;

	@Column(name = "description", nullable = true)
	private String description;

	public int getId() {
		return id;
	}

	public void setName(String value) {
		this.name = value;
	}

	public String getName() {
		return name;
	}

	public void setDescription(String value) {
		this.description = value;
	}

	public String getDescription() {
		return description;
	}

	public void setMedicalRecord(MedicalRecordPo value) {
		this.medicalRecord = value;
	}

	public MedicalRecordPo getMedicalRecord() {
		return medicalRecord;
	}

	public String toString() {
		return String.valueOf(getId());
	}
}
